<form method="post" id="form-box"
      action="<?php echo $this->url(array('action' => 'save', 'boxId' => $this->boxId, 'tId' => $this->templateId));?>" >
<dl class="general-form">
    <dt><label for="block"><?php echo $this->translate('admin')->__('Layout block');?>: </label></dt>
    <dd><?php echo $this->formText('block', isset($this->box['block']) ? $this->box['block'] : '');?></dd>
    <dt><label for="class"><?php echo $this->translate('admin')->__('Box Class');?>:</label></dt>
    <dd><?php echo $this->formSelect(
            'class', 
            isset($this->box['class']) ? $this->box['class'] : null, 
            null, 
            $this->templateBoxes
        )?>
    </dd>
    <dt><label for="sort_order"><?php echo $this->translate('admin')->__('Order');?> <small>(-128 - +127)</small>:</label></dt>
    <dd><?php echo $this->formText(
            'sort_order', 
            isset($this->box['sort_order']) ? $this->box['sort_order'] : null, 
            array('size' => 3)
        );?>
    </dd>
    <dt><label for="box_status"><?php echo $this->translate('admin')->__('Active');?>: </label></dt>
    <dd><?php echo $this->formCheckbox('box_status', 1, 
        array('checked' => (isset($this->box['box_status']) ? ($this->box['box_status'] ? true : false) : false)))?>
    </dd>
    <dt><label for="config"><?php echo $this->translate('admin')->__('Config');?> <small>(option:value,...)</small></label></dt>
    <dd><?php echo $this->formText(
            'config', 
            isset($this->box['config']) ? $this->box['config'] : null, 
            array('size' => 3)
        );?>
    </dd>
</dl>

<table class="ecart-table" cellspacing="0">
<tr>
    <th><?php echo $this->translate('admin')->__('Module')?></th>
    <th><?php echo $this->translate('admin')->__('Controller')?></th>
    <th><?php echo $this->translate('admin')->__('Action')?></th>
    <th><?php echo $this->translate('admin')->__('Show')?></th>
    <th><?php echo $this->translate('admin')->__('Hide')?></th>
    <th><?php echo $this->translate('admin')->__('Tab container')?></th>
    <th><?php echo $this->translate('admin')->__('Separate block')?></th>
    <th><?php echo $this->translate('admin')->__('Separate template')?></th>
</tr>
<?php
$prevModule = $prevController = '';
foreach ($this->pages as $module => $controllers) {
     foreach ($controllers as $controller => $actions) {
         foreach ($actions as $pageId => $action) {
             if (isset($this->assignments[$pageId])) {
                 $show = $this->assignments[$pageId]['box_show'] ? true : false;
                 $hide = !$show;
                 $block = $this->assignments[$pageId]['block'];
                 $tabContainer = $this->assignments[$pageId]['tab_container'];
                 $tpl = $this->assignments[$pageId]['template'];
             } else {
                 $show = $hide = false;
                 $tpl = $block = $tabContainer = '';
             }
             if ($prevModule != $module) {
                 $prevModule = $module;
                 echo '<tr><th colspan="100">' . $module . '</th></tr>';
             }
             
             echo "<tr><td>" . $module . '</td>'
                . '<td>' . $controller . '</td>'
                . '<td>' . $action . '</td>' 
                . '<td>' . $this->formCheckbox("show[$pageId]", 1, array('checked' => $show)) . '</td>'
                . '<td>' . $this->formCheckbox("hide[$pageId]", 1, array('checked' => $hide)) . '</td>'
                . '<td>' . $this->formText("box[$pageId][tab_container]", $tabContainer, array('size' => 8)) . '</td>'
                . '<td>' . $this->formText("box[$pageId][block]", $block, array('size' => 8)) . '</td>'
                . '<td>' . $this->formText("box[$pageId][template]", $tpl, array('size' => 8)) . '</td></tr>';
        }
    }
} 
?>
</table>
</form>